﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BusinessLayer.WorldArtPrice;
using BusinessLayer.WorldArtPrice.Entities;
using CommandLib;
using WorldArtPrice.Models;

namespace WorldArtPrice.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            HomeModel homeModel = new HomeModel();
            homeModel.ContentTypeWellCome = new ContentTypeBL().GetById(Parameter.CONTENTTYPE_WELLCOME);
            homeModel.ContentTypeWhatWeDo = new ContentTypeBL().GetById(Parameter.CONTENTTYPE_WHATWEDO);
            homeModel.ContentWellCome = new ContentBL().GetByContentTypeId(Parameter.CONTENTTYPE_WELLCOME);
            homeModel.ContentWhatWeDo = new ContentBL().GetByContentTypeId(Parameter.CONTENTTYPE_WHATWEDO);
            SlideShow slideShow=new SlideShowBL().GetTop();
            if (slideShow != null)
            {
                homeModel.SlideShow = slideShow;
                homeModel.ListSlideShowDetail = new SlideShowDetailBL().GetBySlideShowId(slideShow.Id);
            }
            homeModel.ImageWhatWeDo = new ImageWhatWeDoBL().GetTop();
            homeModel.ImageArtistLastProject = new ImageLastProjectBL().GetTop1RandomByType(Parameter.PROJECT_IMAGE_ARTIST);
            homeModel.ImageArtWorkLastProject = new ImageLastProjectBL().GetTop1RandomByType(Parameter.PROJECT_IMAGE_ARTWORK);
            homeModel.ImageSignaturesLastProject = new ImageLastProjectBL().GetTop1RandomByType(Parameter.PROJECT_IMAGE_SIGNATURES);
            return View(homeModel);
        }        
    }
}
